﻿
using Family.Core.Model;
using FluentNHibernate.Mapping;

namespace Family.Data.Mappings
{
    public class OrderMap : ClassMap<Order>
    {
        public OrderMap()
        {
            Id(o => o.Id).GeneratedBy.Native();
            Map(o => o.Date).Not.Nullable();

            HasMany(o => o.OrderItems)
                .KeyColumn("OrderId")
                .Cascade.AllDeleteOrphan()
                .Inverse();
        }
    }
}
